<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>营业款账单</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class=" mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">营业款账单</h1>
		</header>
		<div class="mui-content">
			<!--<ul class="record_nav clearfix">
				<li class="left">日期</li>
				<li class="center">款项来源</li>
				<li class="right">到账金额</li>
			</ul>-->
		    <ul class="record_list2" id="yongj_ul">
		    </ul>
		</div>
		<input type="hidden" id="cut_page" value="1" />
		<input type="hidden" id="total_num" value="1" />
		<input type="hidden" id="per_page" value="4" />
	</body>

</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>

<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript">
	var member = JSON.parse(localStorage.getItem('member'));
	get_record();
	function get_record(){
		$.ajax({
		url: APP.api_url + 'agent/records',
		data: {
			token	: member['token'],
			uid		: getUid(),
			agent_id: localStorage.getItem("user_agent_id"),
			type 	: 1
			
		},
		success: function(data) {
			var list = data.list;
			if(list!=null&&list.length!=0) {
				var yue_htm = "";
				for(var i = list.length-1; i >=0; i--) {
					var record=list[i];
					var sty="";
					var user_price;
					if(record['balance']>0){
						sty="style='color: #4AB319;'";
						user_price="+"+record['balance'];
					}else{
						user_price=record['balance'];
					}
					yue_htm +=	"<li class='less clearfix'>"+
		    					"<div class='left'>"+
		    						"<p class='list_nam'>"+record['message']+"</p>"+
					    			"<p class='list_time'>"+record['add_time']+"</p>"+
		    					"</div>"+
		    					"<div class='right' "+sty+">"+user_price+"</div></li>";
				}
				$("#yongj_ul").html(yue_htm);
			} else {
				$("#yongj_ul").html('<p style="text-align:center;width: 100%;background-color: #fff;height: 35px;line-height: 35px;">暂无记录!!</p>');
			}	
		}
	})
}
	
	//底部加载事件
	$(window).scroll(function() {
		if($(document).scrollTop()+1 >= $(document).height() - $(window).height()) {
			var total_num= $("#total_num").val();
			var per_page= $("#per_page").val();
			var page_total = Math.ceil(parseInt(total_num)/parseInt(per_page));
			var cut_page = $("#cut_page").val();
			
			if(cut_page<page_total){
				$("#cut_page").val(parseInt(cut_page) + 1);
				get_record();
			}else{
				layer.msg("已到底部");
			}
		}
	});
</script>
